package com.ruoyi.teaching.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingFileMapper;
import com.ruoyi.teaching.domain.TeachingFile;
import com.ruoyi.teaching.service.ITeachingFileService;
import com.ruoyi.common.core.text.Convert;

/**
 * 文件管理Service业务层处理
 * 
 * @author William
 * @date 2022-10-11
 */
@Service
public class TeachingFileServiceImpl implements ITeachingFileService 
{
    @Autowired
    private TeachingFileMapper teachingFileMapper;

    /**
     * 查询文件管理
     * 
     * @param fileId 文件管理主键
     * @return 文件管理
     */
    @Override
    public TeachingFile selectTeachingFileByFileId(Long fileId)
    {
        return teachingFileMapper.selectTeachingFileByFileId(fileId);
    }

    /**
     * 查询文件管理列表
     * 
     * @param teachingFile 文件管理
     * @return 文件管理
     */
    @Override
    public List<TeachingFile> selectTeachingFileList(TeachingFile teachingFile)
    {
        return teachingFileMapper.selectTeachingFileList(teachingFile);
    }

    /**
     * 新增文件管理
     * 
     * @param teachingFile 文件管理
     * @return 结果
     */
    @Override
    public int insertTeachingFile(TeachingFile teachingFile)
    {
        teachingFile.setCreateTime(DateUtils.getNowDate());
        return teachingFileMapper.insertTeachingFile(teachingFile);
    }

    /**
     * 修改文件管理
     * 
     * @param teachingFile 文件管理
     * @return 结果
     */
    @Override
    public int updateTeachingFile(TeachingFile teachingFile)
    {
        teachingFile.setUpdateTime(DateUtils.getNowDate());
        return teachingFileMapper.updateTeachingFile(teachingFile);
    }

    /**
     * 批量删除文件管理
     * 
     * @param fileIds 需要删除的文件管理主键
     * @return 结果
     */
    @Override
    public int deleteTeachingFileByFileIds(String fileIds)
    {
        return teachingFileMapper.deleteTeachingFileByFileIds(Convert.toStrArray(fileIds));
    }

    /**
     * 删除文件管理信息
     * 
     * @param fileId 文件管理主键
     * @return 结果
     */
    @Override
    public int deleteTeachingFileByFileId(Long fileId)
    {
        return teachingFileMapper.deleteTeachingFileByFileId(fileId);
    }
}
